<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

/**
 * App\HomePage
 *
 * @property int $id
 * @property string|null $img 图片
 * @property int|null $goods_id 商品id
 * @property int|null $sort 排序
 * @property-read \App\Good|null $good
 * @method static \Illuminate\Database\Eloquent\Builder|\App\HomePage whereGoodsId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\HomePage whereId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\HomePage whereImg($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\HomePage whereSort($value)
 * @mixin \Eloquent
 */
class HomePage extends Model
{
    /**
     * @var string
     * 首页设置表
     */

    protected $table='home_pages';
    public $timestamps=false;
    public function good(){
        return $this->belongsTo(Good::class,'goods_id');
    }
    public function getImgAttribute($value){
        return config('filesystems.disks')[config('admin.upload.disk')]['url'].'/'.$value;
    }
}
